// when the DOM is ready...
$(document).ready(function () {
  // load the ticker
  $("#ticker-area").html('<span>\
    I checked the price<br />\
    on HP toners at other<br />\
	suppliers and found<br />\
	I saved 30-35% buying<br />\
	from Hot. I am now<br />\
	converted...<br /><br />\
	- David V.,<br />\
	Victoria<br />\
	October 2010<br />\
  </span>\
  <span>\
    Thank you very much<br />\
    for your help. I should<br \>\
    have come to you<br \>\
	initially instead of<br \>\
    trying to deal with<br />\
    Epson direct.<br />\
    Much appreciated and <br />\
	great service.<br /><br \>\
	- Billy M.,<br />\
	 October 2010<br />\
  </span>\
  <span>\
    You have just saved<br />\
	my life, or at least<br />\
	my business\'s life.<br />\
	Inks arrived in<br />\
	very fast time.<br /><br />\
	Many thanks,<br /><br />\
	- M. Roche,<br />\
	Western Australia<br />\
	October 2010<br />\
  </span>\
  <span>\
    Just a quick email to<br />\
	say thanks for the<br />\
	full refund plus the<br />\
	extra $50 from your<br />\
	"If we stuff up <br />\
	offer." Pity that it<br />\
	didn\'t work out, but<br />\
	...\
  </span>\
  <span>\
    ...happy to visit your<br />\
	website next time I<br />\
	need a new lamp for<br />\
	my projector.<br /><br />\
	- Michael B.,<br />\
	Western Australia<br />\
	September 2010<br />\
  </span>\
  <span>\
	I just wanted to say<br />\
	how impressed I am<br />\
	with the speed of<br />\
	your service and your<br />\
	prices.<br /><br />\
	- Michael Lorenz,<br />\
	 South Australia<br />\
	 August 2010<br />\
  </span>\
  <span>\
	Just a quick note to<br />\
	thank you and your <br />\
	company for the fast<br />\
	and efficient<br />\
	service.<br /><br />\
	- John Sullivan, <br />\
	 August 2010<br />\
  </span>\
  <span>\
	Hi Davin we have <br />\
	received our<br />\
	projector and screen.<br />\
	They are both <br />\
	fantastic...<br />\
	Thanks for your <br />\
	wonderful service.<br />\
	We are both very,<br />\
	very happy.<br />\
	- Eddy and Rose,<br />\
	 April 2010<br />\
  </span>\
  <span>\
	Thanks so much for<br />\
	such excellent<br />\
	service.<br />\
	<br />\
	The printer arrived<br />\
	middle of the day<br />\
	on Thursday, and is<br />\
	now installed and<br />\
	working off all the<br />\
	computers superbly!<br />\
  </span>\
  <span>\
	Thanks once again,<br /><br />\
	- Kelly Cromby,<br />\
	April 2010<br />\
  </span>');
  createTicker();
}); 

function createTicker(){
  var tickerLIs = $("#ticker-area").children();
  tickerItems = new Array();
  tickerLIs.each(function(el) {
	tickerItems.push( jQuery(this).html() );
  });
  i = 0
  rotateTicker();
}

function rotateTicker(){
  if( i == tickerItems.length ){
    i = 0;
  }
  tickerText = tickerItems[i];
  c = 0;
  typetext();
  setTimeout( "rotateTicker()", 5000 );
  i++;
}

var isInTag = false;
function typetext() {	
  //  var thisChar = tickerText.substr(c, 1);
  //  if( thisChar == '<' ){ isInTag = true; }
  //  if( thisChar == '>' ){ isInTag = false; }
  //  $('#ticker-area').html(tickerText.substr(0, c++));
  //  if(c < tickerText.length+1)
  //	if( isInTag ){
  //	  typetext();
  //	}else{
  //	  setTimeout("typetext()", 30);
  //	}
  //  else {
  //	c = 1;
  //	tickerText = "";
  //  }
  $('#ticker-area').html(tickerText);
}
